import { toSuccess, useEntityManager } from "@sker/core"
import { AutoFile } from "@sker/entities"
import { useData } from "@sker/runtime"
import { z } from "zod"

export default async () => {
    const input = z.object({
        version: z.number()
    })
    const body = input.parse(useData())
    return await useEntityManager(async m => {
        const list = await m.find(AutoFile, { where: { version: body.version } })
        return toSuccess(list)
    })
}